//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Ext.h".
//-------------------------------------------------------------------

#ifdef __UX_STL_UNIT_TEST__

#include "../Types/TExtString.h"

using namespace UX_STL;
using namespace UXTypesExt;


void ExtString_Test0()
{
	ext_string	s;

	s.Parse( "#[align:top]fdgdfg#[spacing:1.5]12345#[color:1F2E3D4C]6789" );
	
	ext_string::TReader	reader = s.GetReader();
	
	reader.Move( 3 );
	s.Erase( reader );

	reader.MoveToEnd();
	s.Insert( reader, (uni_c_string) "aaaa" );
	
	//reader.MoveToEnd();

	s.InsertColor( reader, 0xFF1F2D3D );
	s.InsertOffsetX( reader, 4.6f );

	string str;
	s.UnParse( str );

	WARNING( str.cstr() );
}


void ExtString_Test1()
{
	ext_string	s, a;

	s.Parse( "#[spacing:1.4]22#[spacing:1.4]11#[spacing:1.4]1#[spacing:1.4]" );
	
	ext_string::TReader	reader = s.GetReader();

	if ( reader.Find( ext_string::SPACING ) )
		a.AppendChunk( reader );
	
	if ( reader.Find( ext_string::STRING ) )
		a.AppendChunk( reader );

	if ( reader.Find( ext_string::STRING ) )
		a.AppendChunk( reader );

	string str;
	a.UnParse( str );

	WARNING( str.cstr() );
}


void ExtString_Test2()
{
	ext_string	s;

	s.Parse( "#[spacing:1.4]#[spacing:1.1]11112222#[spacing:1.3]" );
	
	ext_string::TReader	reader = s.GetReader();

	reader.Move( 2 );

	s.DivideString( reader, 4 );
	
	//reader.MoveFromStart( 3 );
	s.InsertAlign( reader, ext_string::EAlign::CENTER );

	string str;
	s.UnParse( str );

	WARNING( str.cstr() );
}

#endif	// __UX_STL_UNIT_TEST__